﻿using z_tool.config;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace z_tool
{
    public partial class table_select : Form
    { 
        public table_select()
        {
            InitializeComponent();
        }

        private void table_select_Load(object sender, EventArgs e)
        {
            dataGridView1.DataSource = baseconfig.tables;
            DataGridViewComboBoxColumn column = dataGridView1.Columns["parent_info"] as DataGridViewComboBoxColumn;
            List<itemxx> ixx = new List<itemxx>();
            ixx.Add(new itemxx() { 
                name="无",
                value=""
            });
            foreach (table_info ti in baseconfig.tables)
            {
                ixx.Add(new itemxx() { 
                    name = ti.table_name,
                    value = ti.table_name
                });
            }
            column.DataSource = ixx;
            column.DisplayMember = "name";
            column.ValueMember = "value";
        }

        private void table_select_FormClosing(object sender, FormClosingEventArgs e)
        {
            dataGridView1.EndEdit();
        }
         
    }
}
